package com.xxx.kjds.serviceImpl;

import com.xxx.kjds.entity.Wallets;
import com.xxx.kjds.entity.WalletsExample;
import com.xxx.kjds.mapper.WalletsMapper;
import com.xxx.kjds.service.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WalletServiceImpl implements WalletService {

    @Autowired
    private WalletsMapper walletsMapper;

    @Override
    public long countByExample(WalletsExample example) {
        return walletsMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(WalletsExample example) {
        return walletsMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return walletsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Wallets record) {
        return walletsMapper.insert(record);
    }

    @Override
    public int insertSelective(Wallets record) {
        return walletsMapper.insertSelective(record);
    }

    @Override
    public List<Wallets> selectByExample(WalletsExample example) {
        return walletsMapper.selectByExample(example);
    }

    @Override
    public Wallets selectByPrimaryKey(Integer id) {
        return walletsMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByExampleSelective(Wallets record, WalletsExample example) {
        return walletsMapper.updateByExampleSelective(record, example);
    }

    @Override
    public int updateByExample(Wallets record, WalletsExample example) {
        return walletsMapper.updateByExample(record, example);
    }

    @Override
    public int updateByPrimaryKeySelective(Wallets record) {
        return walletsMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Wallets record) {
        return walletsMapper.updateByPrimaryKey(record);
    }

    @Override
    public Wallets selectByUid(Integer uid) {
        WalletsExample walletsExample = new WalletsExample();
        WalletsExample.Criteria criteria = walletsExample.createCriteria();
        criteria.andUserIdEqualTo(uid);
        List<Wallets> list = walletsMapper.selectByExample(walletsExample);
        if (list.size() > 0) {
            return list.get(0);
        }
        return null;
    }
}
